package cn.tedu.oop2;
/**本类用于oop综合练习*/
public class TestTeacher {
    public static void main(String[] args) {

        Teacher t1 = new Teacher();//无参
        Teacher t2 = new Teacher(666);//含参
        Teacher t3 = new Teacher("宋江",'男',36,1000000);//全参
        t3.eat();//调用普通方法
        System.out.println(t1.getName());//null
        t1.setName("武松");//赋值
        System.out.println(t1.getName());//武松

    }
}
class Teacher{
    private String name;
    private char gender;
    private int age;
    private double salary;
    {
        System.out.println("我是Teacher类的构造代码块");
    }
    public Teacher(){
        {
            System.out.println("我是Teacher类的局部代码块");
        }
        System.out.println("无参构造");
    }
    public Teacher(int n){
        System.out.println("含参构造");
    }

    public Teacher(String name, char gender, int age, double salary) {
        this.name = name;
        this.gender = gender;
        this.age = age;
        this.salary = salary;
        System.out.println("全参构造");
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public char getGender() {
        return gender;
    }

    public void setGender(char gender) {
        this.gender = gender;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }
    public void eat(){
        System.out.println("我是普通方法");
        {
            System.out.println("我是局部代码块");
        }
    }


}
